package com.woniu.adminservice.service.impl;

import com.woniu.adminservice.entity.UsersRole;
import com.woniu.adminservice.dao.UsersRoleDao;
import com.woniu.adminservice.service.UsersRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service("usersRoleService")
public class UsersRoleServiceImpl implements UsersRoleService {
    @Resource
    private UsersRoleDao usersRoleDao;

    @Override
    public UsersRole queryById(Integer id) {
        return usersRoleDao.queryById(id);
    }

    @Override
    public List<UsersRole> queryAllByLimit(int offset, int limit) {
        return usersRoleDao.queryAllByLimit(offset, limit);
    }
   
     @Override
    public List<UsersRole> findAll() {
        return usersRoleDao.findAll();
    }

    @Override
    public UsersRole insert(UsersRole usersRole) {
        usersRoleDao.insert(usersRole);
        return usersRole;
    }

    @Override
    public UsersRole update(UsersRole usersRole) {
        usersRoleDao.update(usersRole);
        return queryById(usersRole.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return usersRoleDao.deleteById(id) > 0;
    }
}